<template>
	<div id="shareAgent">
		<div id="header">
	
				<img id="return" @click="$router.go(-1)" src="../../static/img/return.png"/>
		
			<ul>
				<li><router-link to="/user/shareUser">代言人</router-link></li>
				<li class="active">微客</li>
			</ul>
			<router-link to="/user/minivan"><img src="../../static/img/share-01.png"/></router-link>
		</div>
		<div class="shareAgent_1">
			<img src="../../static/img/share-08.png"/>
			<p>赶紧试累计已发奖励216524元</p>
		</div>
		<!--------二维码---------->
		<div class="shareAgent_2">
			<div class="shareAgent_title">
				<p class="title_left"><span></span><span></span></p>
				<p class="title_text">活动说明</p>
				<p class="title_right"><span></span><span></span></p>
			</div>
			<img src="../../static/img/share-09.png"/>
			<!--<p class="href">https://item.taobao.com/item.htm?spm=a217f.8051907.312171.35.91a03308EXwcfm&id=566541215854</p>
			<div @click="copy" id="toShare">
				<p>复制分享领20元现金</p>
			</div>-->
			<div class="QRcode">
				<div id="qrcode" class="qrcode">
					<!--<img src="../../static/img/code.png"/>-->
				</div>
				<ul>
					<li>方法 1：长按二维码，保存图标，分享给好友。</li>
					<li>方法2：点击下方分享按钮分享到朋友圈或好友。</li>
					<li>
						<router-link :to="{path:'/share2', query:{invite: something.inviteCode}}">
							<img src="../../static/img/share-10.png"/>
							<p>分享领{{something.agReward}}元现金</p>
						</router-link>
					</li>
				</ul>
			</div>
		</div>
		<!---------邀请码---------->
		<div class="shareAgent_3">
			<div class="shareAgent_title">
				<p class="title_left"><span></span><span></span></p>
				<p class="title_text">邀请码</p>
				<p class="title_right"><span></span><span></span></p>
			</div>
			<div class="mycode">
				<p>我的专属邀请码：<span>{{something.inviteCode}}</span></p>
			</div>
			<router-link to="/user/myAgent">
				<img src="../../static/img/share-11.png"/>
				<p>查看商家列表</p>
			</router-link>
		</div>
		<!--------奖励规则----------->
		<div class="shareAgent_4">
			<div class="shareAgent_title">
				<p class="title_left"><span></span><span></span></p>
				<p class="title_text">奖励规则</p>
				<p class="title_right"><span></span><span></span></p>
			</div>
			<ul>
				<li>1.邀请商家并成功发布任务即可获得{{something.agReward}}元现金；</li>
				<li>2.奖励有效期为商家注册起6个月内；</li>
				<li>3.邀请者和被邀请商家手机号相同时无奖励；</li>
				<li>4.商家必须为赶紧试新商家，若通过反作弊系统检测出有作弊行为，将取消奖励、冻结余额并永久封号；</li>
			</ul>
		</div>
	</div>
</template>

<script>
import QRCode from 'qrcodejs2'
export default{
	name: 'shareAgent',
	data: function(){
		return {
			something: {
				
			}
		}
	},
	methods: {
		// 获取相关信息
		getSth: function(){
			var _this = this;
			_this.$axios.post("/user/extends/public/selectSth").then(function(res){
				var data = res.data;
				if(data.message == "succ"){
					_this.something = data.result;
    				_this.qrcode(_this.something.inviteAgLink);
    				$('.qrcode').find('img').css('width','9rem');
    				$('.qrcode').find('img').css('display','block');
				}else{
					console.log(data.result);
				}
			}).catch(function(err){
				console.log(err);
			});
		},
		qrcode:function(url) {
	      	let qrcode = new QRCode('qrcode', {
	        	width: 110,
	        	height: 110, // 高度
	        	text: url, // 二维码内容
	        })
	    },
	    copy:function(){
	    	var Url=$('.href').text();
	        var input = document.createElement("input");
            input.value = Url;
            document.body.appendChild(input);
            input.select();
            input.setSelectionRange(0, input.value.length), document.execCommand('Copy');
            document.body.removeChild(input);
            this.$alert('复制成功!');
	    }
	},
	created: function(){
		this.getSth();
	}
}
</script>

<style scoped>
/* ========== */
/* = Header = */
/* ========== */
#header{
	width: 100%;
	background-color: #fff;
	position: fixed;
	top: 0;
	left: 0;
	height: 4rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-bottom: 1px solid #EEEEEE;
	font-size: 1.2rem;
	color: #4F4F4F;
	box-sizing: border-box;
	z-index: 10;
}
#header #return{
	height: 2rem;
	display: block;
	position: absolute;
	top: 1rem;
	left: 2rem;
}
#header a img{
	height: 2rem;
	display: block;
	position: absolute;
	top: 1rem;
	right: 2rem;
}
#header ul{
	display: flex;
	width: 12rem;
	border: 1px solid #EEEEEE;
	border-radius: 3px;
	overflow: hidden;
}
#header ul li{
	width: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 2.4rem;
}
#header ul li.active{
	background-color: #FF6565;
	color: #FFFFFF;
}
#shareAgent{
	background-color: #FFFFFF;
	padding-top: 4rem;
	padding-bottom: 4rem;
}

.shareAgent_1{
	position: relative;
}
.shareAgent_1 img{
	width: 100%;
	display: block;
}
.shareAgent_1 p{
	position: absolute;
	bottom: 13%;
	width: 100%;
	text-align: center;
	color: #FFFAAE;
	font-size: 1.4rem;
}
/*--------------------*/
.shareAgent_title{
	width: 12rem;
	margin: 0 auto;
	margin-top: -1.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #fff;
	height: 3rem;
	font-size: 1.6rem;
	color: #FF9A00;
	position: relative;
}
.shareAgent_title span{
	display: block;
	width: 0.4rem;
	height: 0.4rem;
	border-radius: 50%;
	background-color: #FF9A00;
}
.shareAgent_title .title_left{
	display: flex;
	align-items: center;
	position: absolute;
	left: 0;
}
.shareAgent_title .title_left span:first-child{
	margin-right: 0.6rem;
}
.shareAgent_title .title_right{
	display: flex;
	align-items: center;
	position: absolute;
	right: 0;
}
.shareAgent_title .title_right span:first-child{
	margin-right: 0.6rem;
}
/*--------二维码------------*/
.shareAgent_2{
	border: 1px solid #FF9A00;
	width: 94%;
	margin: 0 auto;
	margin-top: 1rem;
	padding-bottom: 1rem;
}
.shareAgent_2>img{
	width: 90%;
	display: block;
	margin: 0 auto;
	margin-top: 1rem;
}
.shareAgent_2 .href{
	width: 94%;
	margin: 0 auto;
	color: #FF6565;
	font-size: 1.2rem;
	text-decoration: underline;
	white-space: pre-wrap;
	word-break: break-all;
	line-height: 1.8em;
	margin-top: 1.5rem;
}
#toShare{
	width: 16rem;
	height: 4rem;
	margin: 0 auto;
	margin-top: 1.5rem;
	background: url('../../static/img/share-10.png') no-repeat;
	background-size: 100% 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #FFFFFF;
	font-size: 1.4rem;
}
#toShare p{
	margin-top: -0.6rem;
}
.shareAgent_2 .QRcode{
	width: 94%;
	margin: 0 auto;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 1rem;
	padding-left: 1rem;
	box-sizing: border-box;
}
.shareAgent_2 .QRcode #QRcode{
	/*width: 45%;*/
}
.shareAgent_2 .QRcode #QRcode img{
	width: 100%;
	display: block;
}
.shareAgent_2 .QRcode ul{
	width: calc(95% - 10rem);
	color: #4F4F4F;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.shareAgent_2 .QRcode ul li{
	margin-bottom: 1rem;
}
.shareAgent_2 .QRcode ul li:last-child{
	margin-bottom: 0;
}
.shareAgent_2 .QRcode ul li a{
	width: 100%;
	display: block;
	position: relative;
}
.shareAgent_2 .QRcode ul li a img{
	width: 100%;
	display: block;
}
/*.qrcode{
	padding-left: 15px;
}*/
.shareAgent_2 .QRcode ul li a p{
	width: 100%;
	height: 80%;
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.6rem;
	color: #FFFFFF;
}
/*----------邀请码---------*/
.shareAgent_3{
	width: 94%;
	margin: 0 auto;
	margin-top: 3rem;
	border: 1px solid #FF9A00;
	padding-bottom: 2rem;
}
.shareAgent_3 .mycode{
	background-color: #FFF1C7;
	width: 78%;
	margin: 0 auto;
	border-radius: 50px;
	height: 3rem;
	margin-top: 2rem;
}
.shareAgent_3 .mycode p{
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	color: #FE9E1C;
	font-size: 1.4rem;
}
.shareAgent_3 .mycode p span{
	font-size: 1.8rem;
	font-weight: 600;
	color: #FB3C32;
}
.shareAgent_3 a{
	width: 80%;
	display: block;
	margin: 0 auto;
	position: relative;
	margin-top: 2rem;
}
.shareAgent_3 a img{
	width: 100%;
	display: block;
}
.shareAgent_3 a p{
	width: 100%;
	height: 80%;
	font-size: 1.6rem;
	color: #FFFFFF;
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 0;
	left: 0;
}
/*---------奖励规则-------------*/
.shareAgent_4{
	width: 94%;
	margin: 0 auto;
	margin-top: 3rem;
	border: 1px solid #FF9A00;
	padding-bottom: 2rem;
}
.shareAgent_4 ul{
	width: 90%;
	margin: 0 auto;
	margin-top: 2rem;
}
.shareAgent_4 ul li{
	font-size: 1.2rem;
	color: #4F4F4F;
	line-height: 2rem;
	margin-bottom: 1rem;
}
.shareAgent_4 ul li:last-child{
	margin-bottom: 0;
}

</style>
